package day02;

import java.util.ArrayList;
import java.util.LinkedList;

public class LinkedListDemo {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<String>();

        list.addFirst("a");
        list.addLast("b");
        list.addLast("c");
        list.addLast("d");
        list.addLast("e");

        String s = list.get(3);//O(n)时间复杂度
        ArrayList<String> list1 = new ArrayList();

        String First = list.getFirst();
        System.out.println(First);
        String Last = list.getLast();
        System.out.println(Last);

        String removeFirst = list.removeFirst();
        System.out.println(removeFirst);
        String removeList = list.removeLast();
        System.out.println(removeList);

        System.out.println(list);
    }
}
